package io.renren.modules.jxgk.service.impl;

import io.renren.common.utils.Query;
import io.renren.modules.jxgk.dao.ClassInfoDao;
import io.renren.modules.jxgk.entity.ClassInfo;
import io.renren.modules.jxgk.service.ClassInfoService;
import io.renren.modules.sys.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ClassInfoServiceImpl implements ClassInfoService {

    @Autowired
    ClassInfoDao classInfoDao;

    @Override
    public List<ClassInfo> queryList(Query query) {
        return classInfoDao.queryList(query);
    }

    @Override
    public int queryTotal(Query query) {
        return classInfoDao.queryTotal(query);
    }

    @Override
    public void setAdmin(Map<String, Object> params) {
        classInfoDao.setAdmin(params);
    }

    @Override
    public List<String> getMyClass(Map<String, Object> params) {
        //用户名
        String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
        params.put("username",username);
        return classInfoDao.getMyClass(params);
    }
}
